package com.bitin.adorn.common.orm.domain;

import jakarta.persistence.Column;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.util.Assert;

/**
 * @Author: Mr.Lu
 * @Datetime: 2023/3/28 14:19
 */
@Data
@Builder
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class Address extends AbstractAuditableModel {
    /**
     * 国家
     */
    @Column(nullable = false)
    private String country;
    /**
     * 省份
     */
    @Column(nullable = false)
    private String province;
    /**
     * 城市
     */
    @Column(nullable = false)
    private String city;
    /**
     * 城市
     */
    @Column(nullable = false)
    private String county;
    /**
     * 街道详细地址
     */
    @Column(nullable = false)
    private String street;

    public Address(String country, String province, String city, String county, String street) {
        Assert.hasText(country, "Country must not be null or empty!");
        Assert.hasText(province, "Province must not be null or empty!");
        Assert.hasText(city, "City must not be null or empty!");
        Assert.hasText(county, "County must not be null or empty!");
        Assert.hasText(street, "Street must not be null or empty!");
        this.country = country;
        this.province = province;
        this.city = city;
        this.county = county;
        this.street = street;
    }

    protected Address() {
    }
}
